<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    console.log(localStorage);

    // 设置
    localStorage.setItem('张安','你好')
    localStorage.setItem('张安1','你好1')
    localStorage.setItem('张安2','你好2')

    // 获取
    console.log(localStorage.getItem('张安'));//你好
    console.log(localStorage.getItem('张'));//null

    //删除
    localStorage.removeItem('安')//删除没有不会报错

    // 一键清除
    localStorage.clear()
</script>
</html>